<template>
    <!-- 点击用户头像时显示整体布局页面 -->
    <div id="user-personal-center">
        <el-row type="flex" align="middle">
            <el-col :lg="4">
                <el-image :src="require('@/assets/logo.png')" class="logo" @click="showFirstIndex"/> <!-- logo图标 -->
            </el-col>
            <el-col :lg="12" :offset="3">
                <el-input placeholder="请输入需要搜索的内容" class="content-search">
                <el-button slot="append" class="icon-search">
                    <i class="el-icon-search" id="el-icon-search"/> <!-- 搜索框 -->
                </el-button>
                </el-input>
            </el-col>
            <el-col :lg="5" :offset="3">
                <div class="right-content">
                <span class="index-shop">
                    <i class="el-icon-shopping-cart-1" @click="showOrderCat"/>
                </span>
                <span class="index-advice" @mouseleave="hideSelectList('adviseSelectListRef')">
                    <i class="el-icon-bell"  @click="showView('/advise')" @mouseover="showSelectList('adviseSelectListRef')"/> <!-- 通知图标鼠标悬浮下拉菜单 -->
                    <div id="advise-select-list" ref="adviseSelectListRef"> 
                        <div id="unuse-div"/>
                        <div id="advise-select" @click="showView('/commonAdvise')"><span>公告</span></div>
                        <div id="advise-select" @click="showView('/commentAdvise')"><span>评论</span></div>
                        <div id="advise-select" @click="showView('/followeeAdvise')"><span>关注</span></div>
                        <div id="advise-select" @click="showView('/personalAdvise')"><span>私信</span></div>
                        <div id="advise-select" @click="showView('/systemAdvise')"><span>系统通知</span></div>
                        <div id="advise-select" @click="showView('/adviseSettings')"><span>消息设置</span></div>
                    </div>
                </span>
                <span id="user-avatar" @mouseover="showSelectList('userSelectListRef')" @mouseleave="hideSelectList('userSelectListRef')">
                    <span  @click="showView('/user')"><el-avatar :size="42" src="http://online.sccnn.com/img2/5890/coff160524-03.png"/></span> <!-- 用户头像鼠标悬浮下拉菜单 -->
                    <div id="user-select-list" ref="userSelectListRef">
                    <div id="unuse-div"/>
                    <div id="user-select"  @click="showView('/myFollowee')"><svg-icon icon-class="heart"/>&ensp;我的关注</div>
                    <div id="user-select"  @click="showView('/myCollection')"><svg-icon icon-class="collect"/>&ensp;我的收藏</div>
                    <div id="user-select"  @click="showView('/myInfo')"><svg-icon icon-class="user"/>&ensp;个人中心</div>
                    <div id="user-select"  @click="showView('/accountSettings')"><svg-icon icon-class="setting"/>&ensp;账号设置</div>
                    <el-divider/>
                    <div id="user-select" @click="showView('/myArticle')"><svg-icon icon-class="myArticle"/>&ensp;我的文章</div>
                    <div id="user-select" @click="showView('/putOutArticle')"><svg-icon icon-class="managerArticle"/>&ensp;发布文章</div>
                    <div id="user-select" @click="showView('/writeArticle')"><svg-icon icon-class="writeArticle"/>&ensp;创作文章</div>
                    <el-divider/>
                    <div id="user-select" @click="showView('/myWallet')"><svg-icon icon-class="wallet"/>&ensp;我的钱包</div>
                    <div id="user-select" @click="showView('/myOrder')"><svg-icon icon-class="order"/>&ensp;我的订单</div>
                    <el-divider/>
                    <div id="user-select"><svg-icon icon-class="help"/>&ensp;帮助&ensp;&ensp;&ensp;&ensp;</div>
                    <div id="user-select"><svg-icon icon-class="exit"/>&ensp;退出&ensp;&ensp;&ensp;&ensp;</div>
                    </div>
                </span>
                </div>
            </el-col>
        </el-row>
        <el-container>
            <el-header height="220px">
                <div id="user-personal-center-header">
                    <el-row>
                        <el-col :lg="4">
                            <el-row>
                                <span>
                                    <el-avatar :size="160" src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"/>
                                </span>
                            </el-row>
                            <el-row>
                                <span>
                                    书虫2年 · <svg-icon icon-class="authentication"/>高级认证
                                </span>
                            </el-row>
                        </el-col>
                        <el-col :lg="10">
                            <div>
                                手可摘星辰，世间无我这般人
                            </div>
                            <div>
                                <svg-icon icon-class="occupation"/>律师
                            </div>
                        </el-col>
                        <el-col :lg="8">
                            <el-card>
                                <div slot="header">
                                    <span>个性签名</span>
                                    <span><i class="el-icon-edit"/>编辑</span>
                                </div>
                                <div>
                                    这家伙很懒~，什么都没有留下
                                </div>
                            </el-card>
                        </el-col>
                    </el-row>
                </div>
            </el-header>
            <el-container id="user-personal-center-container">
                <el-aside width="160px">
                    <el-menu :default-active="userDefaultActiveIndex" @select="handlerSelectMenu">
                        <el-menu-item index="/myInfo">
                            个人资料
                        </el-menu-item>
                        <el-menu-item index="/myCollection">
                            我的收藏
                        </el-menu-item>
                        <el-menu-item index="/myFollowee">
                            我关注的人
                        </el-menu-item>
                        <el-menu-item index="/myFans">
                            我的粉丝
                        </el-menu-item>
                        <el-menu-item index="/myArticle">
                            我的文章
                        </el-menu-item>
                        <el-menu-item index="/putOutArticle">
                            发布文章
                        </el-menu-item>
                        <el-menu-item index="/writeArticle">
                            创作文章
                        </el-menu-item>
                        <el-menu-item index="/myWallet">
                            我的钱包
                        </el-menu-item>
                        <el-menu-item index="/myOrder">
                            我的订单
                        </el-menu-item>
                        <el-menu-item index="/accountSettings">
                            账号设置
                        </el-menu-item>
                    </el-menu>
                </el-aside>
                <el-main>
                    <router-view/>
                </el-main>
            </el-container>
            <el-footer>
                <el-row>
                    <el-divider/>
                    <el-row>
                        <el-row>
                        <el-col :span="4" :push="2">
                            <b>网站相关</b>
                        </el-col>
                        <el-col :span="4" :push="2">
                            <b>常用链接</b>
                        </el-col>
                        <el-col :span="4" :push="2">
                            <b>联系我们</b>
                        </el-col>
                        <el-col :span="4" :push="2">
                            <b>关注我们</b>
                        </el-col>
                        <el-col :span="4" :push="2">
                            <b>内容许可</b>
                        </el-col>
                        </el-row>
                        <el-row class="footer-item-content1">
                        <el-col :span="4" :push="2">
                            <div>关于我们</div>
                            <div>服务条款</div>
                            <div>帮助中心</div>
                            <div>编辑器语法</div>
                        </el-col>
                        <el-col :span="4" :push="2">
                            <div>百年智教育</div>
                            <div>百年智论坛</div>
                        </el-col>
                        <el-col :span="4" :push="2">
                            <div>联系我们</div>
                            <div>加入我们</div>
                            <div>建议反馈</div>
                        </el-col>
                        <el-col :span="4" :push="2">
                            <div>微博</div>
                            <div>twitter</div>
                        </el-col>
                        <el-col :span="4" :push="2">
                            除特别说明外，用户内容均采用知识共享署名-非商业性使用-禁止演绎4.0 国际许可协议 (CC BY-NC-ND 4.0) 进行许可
                            <p>
                            本站由 百年智教育 提供更新服务
                            </p>
                        </el-col>
                        </el-row>
                    </el-row>
                    <el-row class="footer-item-content2">
                        Copyright © 2020 百年智集团 当前版本 0.0.1
                    </el-row>
                </el-row>
            </el-footer>
        </el-container>
    </div>    
</template>
<script>
export default {
    name: 'User',
    data() {
        return {
            userDefaultActiveIndex: this.$route.path
        }
    },
    methods: {
        // 点击logo图标时触发事件
        showFirstIndex() {
            this.$router.push({
                path: '/'
            })
        },
        // 点击左侧菜单项触发事件
        handlerSelectMenu(key, keyPath) {
            this.$router.push({
                path: key
            })
        },
        // 鼠标悬浮时触发显示下拉菜单
        showSelectList(refName) {
            this.$refs[refName].style.display = 'block';
        },
        // 鼠标离开时触发隐藏下拉菜单
        hideSelectList(refName) {
            this.$refs[refName].style.display = 'none';
        },
        // 点击购物车图标时触发事件
        showOrderCat() {
            this.$router.push({
                path: '/articleOrder'
            });
        },
        // 点击下拉菜单项时触发
        showView(index) {
            this.$router.push({
                path: index
            })
        }
    },
    watch: {
        $route(to, from) {
            this.userDefaultActiveIndex = to.path;
        }
    }
}
</script>
<style>
    .logo {
        cursor: pointer;
    }
    #user-avatar {
        margin-left: 16px;
    }
    .layout-icon {
        font-size: 30px;
        cursor: pointer;
    }
    #unuse-div {
        background: white;
        height: 12px;
    }
    #user-select {
        cursor: pointer;
        background: white;
        height: 42px;
        line-height: 42px;
        text-align: center;
        vertical-align: middle;
    }
    #user-select:hover {
        background: gainsboro;
    }
    #advise-select {
        cursor: pointer;
        background: white;
        height: 42px;
        line-height: 42px;
        text-align: left;
    }
    #advise-select:hover {
        background: gainsboro;
    }
    #advise-select > span {
        margin-left: 20%;
    }
    #user-select-list .el-divider {
        margin: 12px auto;
    }
    #user-select-list {
        text-align: center;
        border: 1px solid rgba(0, 0, 0, 0.089);
        border-top: none;
        width: 150px;
        position: absolute;
        right: 54px;
        background: white;
        z-index: 100;
        display: none;
    }
    #advise-select-list {
        border: 1px solid rgba(0, 0, 0, 0.089);
        border-top: none;
        width: 126px;
        position: absolute;
        right: 54px;
        background: white;
        z-index: 100;
        display: none;
    }
    .right-content {
        height: 42px;
    }
    .right-content > span {
        vertical-align: middle;
        display: -moz-inline-box; 
        display: inline-block;
        text-align: center; 
        width: 42px;
    }
    .right-content .el-avatar {
        cursor: pointer;
    }
    .right-content .login-regist {
        display: -moz-inline-box; 
        display: inline-block;
        text-align: center; 
        width: 100px;
    }
    .index-advice, .index-shop, .login-regist {
        display: -moz-inline-box; 
        display: inline-block;
        height: 42px;
        line-height: 42px;
    }
    .index-advice i, .index-shop i {
        cursor: pointer;
        font-size: 24px;
    }
    #el-icon-search {
        color: white;
    }
    .icon-search i {
        color: rgb(14, 44, 99);
    }
    .content-search .el-input-group__append {
        border-color: rgb(14, 44, 99);
    }
    .content-search .el-input-group__append {
        background-color: rgb(14, 44, 99);
        color: white;
    }
    a {
        text-decoration: none;
        color: black;
    }
    .footer-item-content1 {
        margin-top: 1%; 
        font-size: 14px;
    }
    .footer-item-content2 {
        font-size: 14px; 
        color: gray; 
        text-align: center;
    }
    #user-personal-center > .el-row {
        margin-left: 3%;
    }
    #user-personal-center > .el-container {
        width: 94%;
        margin: auto;
    }
    #user-personal-center-container .el-aside {
        box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
    }
    #user-personal-center-container .el-main {
        box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
        margin-left: 1%;
    }
    #user-personal-center-container .el-menu {
        border-right: none;
        text-align: center;
    }
    #user-personal-center-container .el-menu .el-menu-item {
        font-size: 16px;
    }
    #user-personal-center-container {
        padding: 0px 20px;
    }
    #user-personal-center-header .el-col:nth-of-type(2) div:first-of-type {
        margin-top: 12%;
        font-size: 22px;
    }
    #user-personal-center-header .el-col:nth-of-type(2) div:nth-of-type(2) {
        margin-top: 3%;
        color: #6b6c70;
    }
    #user-personal-center-header .el-col:first-of-type .el-row {
        margin-top: 5%
    }
    #user-personal-center-header .el-col:first-of-type .el-row:last-of-type span {
        font-size: 14px;
        color: #6b6c70;
    }
    #user-personal-center-header .el-col:first-of-type {
        margin-left: 3%;
        text-align: center;
    }
    #user-personal-center-header .el-col {
        height: 100%;
    }
    #user-personal-center-header .el-card div:first-of-type span:last-of-type  {
        cursor: pointer;
        float: right;
    }
    #user-personal-center-header .el-card div:nth-of-type(2) {
        color: gray;
    }
    #user-personal-center-header .el-card {
        margin: 5% auto;
    }
    #user-personal-center-header > .el-row {
        box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
    }
</style>